<?php
class HModuleItemWidget implements IWidget {
	function render() {				
		// Get all module instances 
		$result = array();
		$a = HSql::fetch2Array(HSql::getData('portal_modules_instances',"ORDER BY id DESC"));
		
		// validate system modules
		if (count($a) > 0) {
			for ($i = 0; $i < count($a); $i++) {
				// check if it is the system module				
				$module_id = $a[$i]['module_id'];
				// Get is System
				$c = HSql::fetch2Array(HSql::getData('portal_modules',"WHERE id = '".$module_id."'"));
				$isSystem = $c[0]['is_system'];
							
				// Validate
				if ($isSystem == 0) $result[] = $a[$i];
			}
		}
		?>
		<select name="drpModules">
			<?php 
			for ($i = 0; $i < count($result); $i++) {								
			?>
			<option value="<?php echo $result[$i]['id'];?>">
				<?php echo HPagesModulesAdmin::getModuleAlias($result[$i]['id']);?>
			</option>
			<?php
			}
			?>
		</select>
		<?php	
	}
}

?>